const app = getApp()
import {
  pickup_qrcode
} from '../../api/order'

const util = require('../../utils/util.js')
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    img:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    qrcodeClick(id) {
      var _this = this
      pickup_qrcode({orderId:id}).then(
        res => {
          console.log(res)
          _this.data.img = app.APP_BASE_API + '/zxing/createImage?data='+res.content
          _this.setData({
            img:_this.data.img
          })
        }
      ).catch(error => {
        console.log(error)
        wx.showToast({
          title: '服务器开小差，请重试',
          icon: "none",
          duration: 1500
        })
      })
    },
    cancelClick(){
      this.triggerEvent('cancelClick')

    }
  }
})
